# https://stackoverflow.com/questions/56128805/how-to-start-janusgraph-server-with-foundationdb-on-a-different-host-or-containe/69538366#69538366
FROM fedora

ENV JANUSGRAPH_VERSION 0.3.0
ENV JANUS_FDB_VERSION 0.1.0

RUN yum install -y java-1.8.0-openjdk-devel wget unzip which

RUN mkdir -p /root/downloads; \
    cd /root/downloads; \
    wget -q "https://github.com/JanusGraph/janusgraph/releases/download/v$JANUSGRAPH_VERSION/janusgraph-$JANUSGRAPH_VERSION-hadoop2.zip" -O "janusgraph.zip"; \
    wget -q "https://github.com/experoinc/janusgraph-foundationdb/releases/download/v$JANUS_FDB_VERSION/janusgraph-foundationdb-$JANUS_FDB_VERSION-distribution.zip" -O "janusgraph-foundationdb.zip";

RUN mkdir -p /root/install; \
    cd /root/install; \
    unzip -q "/root/downloads/janusgraph.zip"; \
    unzip -q "/root/downloads/janusgraph-foundationdb.zip";

RUN cd /root/install; \
    cd "janusgraph-foundationdb-$JANUS_FDB_VERSION"; \
    ./install.sh "/root/install/janusgraph-$JANUSGRAPH_VERSION-hadoop2";

COPY "start-janusgraph.sh" /root/install/

ENTRYPOINT ["/root/install/start-janusgraph.sh"]
